﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <title>%(DocumentTitle)</title>
    <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
    <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
    <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css' />
    <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css' />
    <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css' />
    <link href='css/reset.css' media='print' rel='stylesheet' type='text/css' />
    <link href='css/print.css' media='print' rel='stylesheet' type='text/css' />
    %(StylesheetsHtml)
    <script src='lib/object-assign-pollyfill.js' type='text/javascript'></script>
    <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
    <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
    <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
    <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
    <script src='lib/handlebars-4.0.5.js' type='text/javascript'></script>
    <script src='lib/lodash.min.js' type='text/javascript'></script>
    <script src='lib/backbone-min.js' type='text/javascript'></script>
    <script src='swagger-ui.min.js' type='text/javascript'></script>
    <script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
    <script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
    <script src='lib/jsoneditor.min.js' type='text/javascript'></script>
    <script src='lib/marked.js' type='text/javascript'></script>
    <script src='lib/swagger-oauth.js' type='text/javascript'></script>

    <!-- Some basic translations -->
    <script src='lang/translator.js' type='text/javascript'></script>
    <script src='/scripts/lang.zh-Hans.js' type='text/javascript'></script>

    <script type="text/javascript">
        window.JSConfig = JSON.parse('%(JSConfig)');

        $(function () {
            hljs.configure({
                highlightSizeThreshold: 5000
            });

            // Pre load translate...
            if (window.SwaggerTranslator) {
                window.SwaggerTranslator.translate();
            }

            window.swaggerUi = new SwaggerUi({
                url: JSConfig.SwaggerEndpoints[0].Url,
                validatorUrl: JSConfig.ValidatorUrl,
                dom_id: "swagger-ui-container",
                booleanValues: JSConfig.BooleanValues,
                supportedSubmitMethods: JSConfig.SupportedSubmitMethods,
                onComplete: function (swaggerApi, swaggerUi) {
                    if (typeof initOAuth == "function") {
                        initOAuth({
                            clientId: JSConfig.OAuth2ClientId,
                            clientSecret: JSConfig.OAuth2ClientSecret,
                            realm: JSConfig.OAuth2Realm,
                            appName: JSConfig.OAuth2AppName,
                            scopeSeparator: JSConfig.OAuth2ScopeSeparator,
                            additionalQueryStringParams: JSConfig.OAuth2AdditionalQueryStringParams
                        });
                    }

                    if (window.SwaggerTranslator) {
                        window.SwaggerTranslator.translate();
                    }

                    _.each(JSConfig.OnCompleteScripts, function (script) {
                        $.getScript(script);
                    });
                },
                onFailure: function (data) {
                    log("Unable to Load SwaggerUI");

                    _.each(JSConfig.OnFailureScripts, function (script) {
                        $.getScript(script);
                    });
                },
                docExpansion: JSConfig.DocExpansion,
                jsonEditor: JSConfig.JsonEditor,
                defaultModelRendering: 'schema',
                showRequestHeaders: JSConfig.ShowRequestHeaders,
                showOperationIds: false
            });

            window.swaggerUi.load();

            function log() {
                if ('console' in window) {
                    console.log.apply(console, arguments);
                }
            }
        });
    </script>
</head>

<body class="swagger-section">
    <div id='header'>
        <div class="swagger-ui-wrap">
            <a id="logo" href="http://swagger.io"><img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" /><span class="logo__title">swagger</span></a>
            <form id='api_selector'>
                <div class='input'>
                    <input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text" />
                    <div id='auth_container'></div>
                    <select id="select_document"></select>
                    <script type="text/javascript">
                        // Append configured endpoints as options in the document selector
                        var options = '';
                        $.each(JSConfig.SwaggerEndpoints, function (index, endpoint) {
                            options += "<option value='" + endpoint.Url + "'>" + endpoint.Description + "</option>";
                        });
                        $('#select_document').append(options);

                        $('#select_document').change(function () {
                            $('#input_baseUrl').val($(this).val());
                            window.swaggerUi.headerView.showCustom();
                        });
                    </script>
                </div>
            </form>
        </div>
    </div>

    <div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
    <div id="swagger-ui-container" class="swagger-ui-wrap"></div>
</body>
</html>
